package tjs.study.notes.eureka.clienta.order.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import tjs.study.notes.eureka.clienta.order.service.OrederService;

/**
 * Created by Nicky.Tang on 2021/10/31 4:48 下午
 *
 * @since 02.12.10
 */
@RestController
@RequestMapping
public class OrderController {
    @Autowired
    OrederService orederService;

    @RequestMapping(path = "/newOrder/{userId}")
    public String newOrder(@PathVariable("userId") String userId) {
        return orederService.newOrder(userId, null);
    }

    @RequestMapping(path = "/newOrder/{userId}/{sleepTime}")
    public String newOrder(@PathVariable("userId") String userId, @PathVariable("sleepTime") Integer sleepTime) {
        return orederService.newOrder(userId, sleepTime);
    }

}
